<template>
  <div>
    <div>
      <h4 class="text-center">查看剩余假期</h4>
    </div>
    <div>
      <table class="table table-bordered table-striped table-hover">
        <thead>
        <tr class="table">
          <th>工号</th>
          <th>姓名</th>
          <th>剩余年假天数</th>
          <th>剩余病假天数</th>
          <th>剩余婚假天数</th>
          <th>剩余产假天数</th>
          <th>剩余哺乳假分钟数</th>
          <th>剩余陪产假天数</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="item in tabledata" >
          <td>{{ item.e_ID }}</td>
          <td>{{ item.e_NAME}}</td>
          <td>{{ item.e_RYEAR }}</td>
          <td>{{ item.e_RILL }}</td>
          <td>{{ item.e_RWEDDING }}</td>
          <td>{{ item.e_RMATERNITY }}</td>
          <td>{{ item.e_RLACTATION }}</td>
          <td>{{ item.e_RPATERNITY }}</td>
        </tr>
        </tbody>
      </table>
    </div>
  </div>

</template>

<script>
import axios from 'axios'
export default {
  name: 'MyReduse',
  //props: ['id'],
  data() {
    return {
      tabledata:[]
    }
  },
  mounted() {
    console.log(localStorage.getItem('token'));
    this.fetchdata();
  },
  methods: {
    //获取后端数据
    fetchdata() {
      let id = localStorage.getItem('token');
      console.log(id);
      axios.get('/api/employee/restvocation/'+id).then(res => {
        console.log(res.data);
        this.tabledata = res.data.data;
      })
          .catch(err => {
            console.log(err.message)
          })
    },
  }
}
</script>

<style lang="less" scoped>
.table{
  background-color: #efefef;
  text-align:center;
}
</style>